//
//  MLTabBarController.m
//  MLSina20160625_Objective-C
//
//  Created by manmanlang on 16/6/25.
//  Copyright © 2016年 manmanlang. All rights reserved.
//

#import "MLTabBarController.h"
#import "MLDiscoverController.h"
#import "MLHomeController.h"
#import "MLMessageController.h"
#import "MLProfileController.h"
#import "MLNavigationController.h"
#import "MLTabBar.h"

@interface MLTabBarController ()

@end

@implementation MLTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    MLTabBar *tabBarView = [[MLTabBar alloc] init];
    tabBarView.frame = self.tabBar.bounds;
    [self.tabBar addSubview:tabBarView];
    [self addChildViewController];
    
    
}

- (void)addChildViewController {
    
    MLDiscoverController *discoverC = [[MLDiscoverController alloc] init];
    MLNavigationController *discoverNC = [[MLNavigationController alloc] initWithRootViewController:discoverC];
    
    MLHomeController *homeC = [[MLHomeController alloc] init];
    MLNavigationController *homeNC = [[MLNavigationController alloc] initWithRootViewController:homeC];
    
    UIViewController *loginC = [[UIViewController alloc] init];
    loginC.view.backgroundColor = [UIColor blackColor];
    UINavigationController *loginNC = [[UINavigationController alloc] initWithRootViewController:loginC];
    
    MLMessageController *messageC = [[MLMessageController alloc] init];
    MLNavigationController *messageNC = [[MLNavigationController alloc] initWithRootViewController:messageC];
    
    MLProfileController *profileC = [[MLProfileController alloc] init];
    MLNavigationController *profileNC = [[MLNavigationController alloc] initWithRootViewController:profileC];
    
    self.viewControllers = @[homeNC,messageNC,loginNC,discoverNC,profileNC];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
